<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>

<body>
  <!-- 
    分支结构
      v-if
      v-else
      v-else-if

    v-show
      控制元素样式是否显示(display:none)

    v-if与v-show的区别
      v-if控制元素是否渲染到页面(耗性能大)
      v-show控制元素是否显示页面(频繁切换推荐使用)
  -->
  <div id="app">
    <div v-if="score>=90">优秀</div>
    <div v-else-if="score<90&&score>=80">良好</div>
    <div v-else-if="score<80&&score>=60">及格</div>
    <div v-else>不及格</div>

    <div v-if="flag1">单独测试v-if</div>
    <div v-show="flag2">单独测试v-show</div>
    <button @click=handle()>点击</button>
  </div>
  <script src="../js/vue.js"></script>
  <script>
    const vm = new Vue({
      el: "#app",
      data: {
        score: 91,
        flag1: true,
        flag2: true
      },
      methods: {
        handle() { //切换显示与隐藏
          this.flag1 = !this.flag1;
          this.flag2 = !this.flag2;
        }
      }
    });

  </script>
</body>

</html>
